index.html.vue 8.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274
  1. <template>
  2. <!-- 页面头部 -->
  3. <HomePageHead></HomePageHead>
  4. <HomePageNavigation></HomePageNavigation>
  5. <!-- 广告位 1 -->
  6. <HomeAdvertising :imgurl="adImg1"></HomeAdvertising>
  7. <!-- 面包屑导航 -->
  8. <div class="breadcrumb breadcrumb_phone_none">
  9. <div class="inner">
  10. <span class="location">当前位置:</span>
  11. <el-breadcrumb :separator-icon="ArrowRight">
  12. <el-breadcrumb-item>
  13. <NuxtLink to="/">首页</NuxtLink>
  14. </el-breadcrumb-item>
  15. <el-breadcrumb-item>
  16. {{ newsDetail.con_title ? newsDetail.con_title : bottomMenu[num]?.name }}
  17. </el-breadcrumb-item>
  18. </el-breadcrumb>
  19. </div>
  20. </div>
  21. <div class="breadcrumb_box breadcrumb_pc_none">
  22. <span class=" ">当前位置:</span>
  23. <NuxtLink to="/">首页</NuxtLink>
  24. <span class=" ">&gt;</span>
  25. <span class=" ">
  26. {{ newsDetail.con_title ? newsDetail.con_title : bottomMenu[num]?.name }}
  27. </span>
  28. </div>
  29. <!-- 资讯列表 -->
  30. <div class="newsDetail">
  31. <div class="inner">
  32. <div class="innerDetail">
  33. <div class="headImg"></div>
  34. <div class="innerDetail1">
  35. <div class="leftBottom" v-html="newsDetail.content"></div>
  36. </div>
  37. <div class="footImg"></div>
  38. </div>
  39. <div class="innerLeft">
  40. <ul>
  41. <li>
  42. 导航列表
  43. </li>
  44. <li v-for="(item, index) in bottomMenu" :key="index">
  45. <NuxtLink v-if="item.type == 0" :to="`/about/${item.name_pinyin}/index.html`" :title="item.name"
  46. :class="item.id == pageId ? 'active' : ''">
  47. {{ item.name }}
  48. </NuxtLink>
  49. <NuxtLink v-else-if="item.type == 1" :to="`/about/${item.name_pinyin}/list-1.html`"
  50. :title="item.name" :class="item.id == pageId ? 'active' : ''">
  51. {{ item.name }}
  52. </NuxtLink>
  53. </li>
  54. </ul>
  55. </div>
  56. <div style="clear: both;"></div>
  57. </div>
  58. </div>
  59. <!-- 广告位 2 -->
  60. <HomeAdvertising :imgurl="adImg2"></HomeAdvertising>
  61. <!-- 页面底部 -->
  62. <HomeFoot1></HomeFoot1>
  63. </template>
  64. <script setup>
  65. //1.页面依赖 start ---------------------------------------->
  66. import { ElBreadcrumb, ElBreadcrumbItem } from 'element-plus'
  67. import { ArrowRight } from '@element-plus/icons-vue'
  68. import { ref, onMounted } from 'vue';
  69. //获得跳转过来的id
  70. const route = useRoute();
  71. //获得当前的完整路径
  72. const fullPath = route.path;
  73. //拆分,取出来中间这一段,然后提取数字部分
  74. const segments = fullPath.split('/');
  75. const targetSegment = segments[2];
  76. //const numberPart = targetSegment.match(/\d+$/)?.[0];
  77. let num = ref(0);
  78. let articleId;
  79. let pageId;
  80. //通过导航路径反向查询导航id
  81. const getRouteId = await requestDataPromise('/web/getWebsiteRoute', {
  82. method: 'GET',
  83. query: {
  84. 'foot_pinyin': targetSegment,
  85. },
  86. });
  87. if (getRouteId.code == 200) {
  88. articleId = getRouteId.data.id;
  89. pageId = getRouteId.data.id;
  90. } else {
  91. console.log("SSR waring ---------- SSR waring ---------- SSR waring ---------->")
  92. console.log("错误位置:通过url路径查询导航池id")
  93. console.log("后端错误反馈:", getRouteId.message)
  94. console.log("SSR waring ---------- SSR waring ---------- SSR waring ---------->")
  95. }
  96. //1.页面依赖 end ---------------------------------------->
  97. //2.页面数据 start ---------------------------------------->
  98. //广告列表
  99. let adImg1 = ref([]);
  100. let adImg2 = ref([]);
  101. //获取详情
  102. const newsDetail = ref({})
  103. async function getPageData() {
  104. const mkdata = await requestDataPromise('/web/getWebsiteFooterCategoryInfo', {
  105. method: 'GET',
  106. query: {
  107. 'fcat_id': articleId,
  108. 'type': '0'
  109. },
  110. });
  111. console.log('newsDetail.value', mkdata.data);
  112. newsDetail.value = mkdata.data;
  113. console.log('newsDetail.value', newsDetail.value);
  114. }
  115. getPageData();
  116. //获得底部导航
  117. const bottomMenu = ref([]);
  118. async function getPageMenu() {
  119. const mkdata = await requestDataPromise('/web/getWebsiteFooterCategory', {
  120. method: 'GET',
  121. query: {},
  122. });
  123. if (mkdata.code == 200) {
  124. bottomMenu.value = mkdata.data;
  125. mkdata.data.forEach((item, index) => {
  126. if (item.id == articleId) {
  127. num.value = index;
  128. }
  129. });
  130. }
  131. }
  132. getPageMenu();
  133. //2.页面数据 end ---------------------------------------->
  134. //4.设置seo信息 start---------------------------------------->
  135. //4.1 设置seo信息
  136. const setData = await requestDataPromise('/web/getWebsiteFootInfo', {
  137. method: 'GET',
  138. query: {},
  139. });
  140. let seoTitle = setData.data.website_head.title;
  141. let seoDescription = setData.data.website_head.description;
  142. let seoKeywords = setData.data.website_head.keywords;
  143. let seoSuffix = setData.data.website_head.suffix;
  144. let seoName = setData.data.website_head.website_name;
  145. useSeoMeta({
  146. title: seoTitle + "_" + seoSuffix,
  147. meta: [
  148. { name: 'description', content: seoDescription + "_" + seoName + "_" + seoSuffix, tagPriority: 10 },
  149. { name: 'keywords', content: seoKeywords + "_" + seoName + "_" + seoSuffix, tagPriority: 10 },
  150. { name: 'viewport', content: 'width=device-width,initial-scale=1,user-scalable=no' }
  151. ]
  152. });
  153. //4.设置seo信息 end---------------------------------------->
  154. onMounted(async () => {
  155. //从客户端获取行政职能部门 加快打开速度
  156. const { $webUrl, $CwebUrl } = useNuxtApp();
  157. //广告1
  158. let url = `${$webUrl}/web/getWebsiteAdvertisement?ad_tag=xcw_page_0001`
  159. const responseAd1 = await fetch(url, {
  160. headers: {
  161. 'Content-Type': 'application/json',
  162. 'Userurl': $CwebUrl,
  163. 'Origin': $CwebUrl
  164. }
  165. });
  166. const resultAd1 = await responseAd1.json();
  167. adImg1.value = resultAd1.data[0];
  168. //广告2
  169. let url2 = `${$webUrl}/web/getWebsiteAdvertisement?ad_tag=xcw_page_0002`
  170. const responseAd2 = await fetch(url2, {
  171. headers: {
  172. 'Content-Type': 'application/json',
  173. 'Userurl': $CwebUrl,
  174. 'Origin': $CwebUrl
  175. }
  176. });
  177. const resultAd2 = await responseAd2.json();
  178. adImg2.value = resultAd2.data[0];
  179. })
  180. </script>
  181. <style lang="less" scoped>
  182. @import '@/assets/css/about.less';
  183. </style>
  184. <style lang="less" scoped>
  185. @media screen and (min-width:801px){/*pc*/
  186. .breadcrumb_pc_none{display:none!important;}
  187. .pc_none{display:none;}
  188. }
  189. @media screen and (max-width:800px){/*ipad_phone*/
  190. .breadcrumb_box{
  191. height:22px;width:100%;margin:16px auto 9px;
  192. word-break: keep-all; white-space: nowrap;overflow:hidden;text-overflow:ellipsis;
  193. width:92%;
  194. font-size:14px;
  195. color:#666;
  196. *{
  197. font-size:14px;
  198. display:inline ;
  199. color:#666;
  200. line-height:22px;height:22px;
  201. margin-right:5px;
  202. }
  203. }
  204. .newsDetail{min-height:auto;}
  205. .newsDetail .inner{width:92%!important;}
  206. .newsDetail .inner .innerDetail{width:100%;margin-bottom:8px;}
  207. .newsDetail .inner .innerDetail .innerDetail1{width:100%;padding:10px;}
  208. .newsDetail .inner .innerDetail .headImg{display:none;}
  209. .newsDetail .inner .innerDetail .footImg{display:none;}
  210. .newsDetail .inner .innerDetail .innerDetail1{background:rgba(0,0,0,0);border:1px solid #DBBE9E}
  211. .newsDetail .inner .innerDetail .leftBottom *{
  212. font-size: 16px!important;;
  213. line-height: 22px;
  214. }
  215. .breadcrumb_phone_none{display:none!important;}
  216. // .innerLeft{display:none;}
  217. .phone_none{display:none;}
  218. }
  219. </style>